#ifndef LIBVZCONN_CONN_IPCSERVER_H_
#define LIBVZCONN_CONN_IPCSERVER_H_

#include "vzconn/base/basicdefines.h"
#include "vzconn/conn/vzserver.h"

namespace vzconn {
  
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
class IpcServer : public VzServer {
 public:
  explicit IpcServer(boost::asio::io_service &io_service,
                     const std::string addr,
                     uint16 port);
  virtual ~IpcServer();

  virtual bool Start();

  virtual const std::string bind_addr() const ;
 protected:

  virtual void WaitNextConnect();
  virtual void HandleStopVzServer();
 private:
  std::string ipc_file_;
  boost::scoped_ptr<boost::asio::local::stream_protocol::acceptor> acceptor_;
  bool stop_;
};
#endif

}

#endif // LIBVZCONN_CONN_IPCSERVER_H_